<?php
namespace App\Models;
/**
This is the model class for table "users_staffs".
 * @property int10unsigned id
 * @property int10unsigned uid	用户id
 * @property tinyint1unsigned cate	个人用户基本类型：1，工厂员工；2，公司员工
 * @property varchar50 realname	真实姓名
 * @property tinyint1unsigned sex	性别：1男；2，女
 * @property date birthday	出生日期
 * @property tinyint2unsigned education	最高学历：1小学；2初中；3高中/中专/专科；4本科；5研究生；6博士；7其他
 * @property floatunsigned weight	体重
 * @property tinyint1unsigned political_status	政治面貌：1群众；2团员；3党员
 * @property varchar50 native_place	籍贯
 * @property varchar50 nationality	民族
 * @property tinyint1unsigned marriage	婚姻状态：1未婚；2已婚；3离异
 * @property varchar20 idcard	身份证号码
 * @property varchar255 house	住宿情况
 * @property varchar255 image	形象照
 * @property varchar255 sfzzm	身份证正面
 * @property varchar255 sfzfm	身份证反面
 * @property varchar255 household_address	户口地址
 * @property varchar255 residential_address	居住地址
 * @property varchar50 contact_person	紧急联系人
 * @property varchar20 contact_phone	紧急联系人号码
 * @property int20unsigned salary	希望薪资
 * @property varchar255 skill	专业技能
 * @property varchar255 hobby	兴趣爱好
 * @property tinyint3unsignedzerofill job	职位ID，关联jobs
 * @property int10unsigned created_at	创建时间
 * @property int10unsigned updated_at	更新时间
 * @property tinyint3unsigned shenhe	0表示没有审核,1表示审核通过
 * @property int10unsigned visible	0表示隐藏,1表示显示,和功能开关对应
 * @property varchar255 job_str	职位名称
 */
class UserStaffModel extends Model
{
    protected $table = 'users_staffs';
    protected $fillable = ["realname","uid","job","cate",
        "created_at","updated_at","sex","birthday","education",
        "weight","political_status","native_place","nationality",
        "marriage","idcard","house","image","sfzzm","sfzfm",
        "household_address","residential_address","contact_person",
        "contact_phone","salary","skill","hobby"
        ];

    const education_xiaoxue=1;
    const education_chuzhong=2;
    const education_gaozhong_zhognzhuan_zhuanke=3;

    const education_benke=4;
    const education_yanjiusheng=5;
    const education_boshi=6;

    const education_qita=7;


    const shenhe_weishenhe=0;
    const shenhe_tongguo=1;
    const shenhe_jujue=2;


    const visible_show=1;
    const visible_hide=0;

    const house_xuyao='xuyao';///需要住宿
    const house_buxuyao='buxuyao';///不需要住宿



    ///最高学历：1小学；2初中；3高中/中专/专科；4本科；5研究生；6博士；7其他
    public static function educationTo($type){
        $list=[
            self::education_xiaoxue=>'小学',
            self::education_chuzhong=>'初中',
            self::education_gaozhong_zhognzhuan_zhuanke=>'高中/中专/专科',

            self::education_benke=>'本科',
            self::education_yanjiusheng=>'研究生',
            self::education_boshi=>'博士',

            self::education_qita=>'其他',

        ];
        if(!$type){
            return $list;
        }
        return isset($list[$type])?$list[$type]:'';
    }

    ///需要住宿
    public static function tohouse($type=null){
        $list=[
            self::house_xuyao=>'需要住宿',
            self::house_buxuyao=>'不需要住宿',

        ];
        if($type===null){
            return $list;
        }
        return isset($list[$type])?$list[$type]:'';
    }

    public function attributeLabels() {
        return [
            'id' => '',
            'uid' => '用户id',
            'cate' => '个人用户基本类型：1，工厂员工；2，公司员工',
            'realname' => '真实姓名',
            'sex' => '性别',
            'birthday' => '出生日期',
            'education' => '最高学历：1小学；2初中；3高中/中专/专科；4本科；5研究生；6博士；7其他',
            'weight' => '体重',
            'political_status' => '政治面貌：1群众；2团员；3党员',
            'native_place' => '籍贯',
            'nationality' => '民族',
            'marriage' => '婚姻状态：1未婚；2已婚；3离异',
            'idcard' => '身份证号码',
            'house' => '住宿情况',
            'image' => '形象照',
            'sfzzm' => '身份证正面',
            'sfzfm' => '身份证反面',
            'household_address' => '户口地址',
            'residential_address' => '居住地址',
            'contact_person' => '紧急联系人',
            'contact_phone' => '紧急联系人号码',
            'salary' => '希望薪资',
            'skill' => '专业技能',
            'hobby' => '兴趣爱好',
            'job' => '职位ID，关联jobs',
            'created_at' => '创建时间',
            'updated_at' => '更新时间',
            'shenhe' => '审核',
            'visible' => '显示',
            'job_str' => '职位名称',
        ];
    }



}